{include file='public/meta'}
<title>回收站列表 - 内容管理 - 木鱼内容管理系统</title>
</head>
<body>
    <style>
    .layui-nav .layui-nav-item a:hover, .layui-nav .layui-this a {
        color: #000000;
    }
    .layui-nav .layui-nav-item a {
    color: #000000;
    color: rgb(0,0,0,0.9);
    }
    .layui-nav{
        padding:0 0;
    }
    .layui-nav .layui-nav-more{border-top-color:#535353;}
    .layui-nav .layui-nav-mored{border-color: transparent transparent #535353;}
    .layadmin-tips .layui-text{width:10%;}
    .layadmin-tips .layui-icon[face] {font-size: 100px;}
    </style>
	<div class="layui-fluid">
		<div class="layui-card">
			<div class="layui-card-body">
            <div style="padding: 10px; background-color: #FAFAFA;">
              <div class="layui-row layui-col-space15">
                <div class="layui-col-md13">
                <div class="layui-card">
                    <div class="layui-card-header muyu-text">共有数据：<span style="color:red;">{$num}</span> 条</div>
                    <div class="layui-card-body" style="display:inline-block;">
                    <div class="layui-btn-container" style="display:inline-block;">
					  <a class="layui-btn layui-btn-xs layui-btn-danger" onclick="delcheck()" href="javascript:;">删除选中</a>
					  <a class="layui-btn layui-btn-xs layui-btn-normal" onclick="rescheck()" href="javascript:;">还原选中</a>
					</div>
                    </div>
                    </div>
                </div>
                </div>  
            </div>    
            {if (!empty($list))}
            <div class="layui-table-body layui-table-main">
                <table class="layui-table" id="LAY-user-front-submit">
					<thead>
						<tr>
						    <th class=" layui-table-col-special">
							    <div class="layui-table-cell laytable-cell-checkbox">
							        <input type="checkbox" id="checkAll" onclick="isCheck()">
							    </div>
							</th>
							<th>
								<div class="layui-table-cell" align="center"><span>id</span></div>
							</th>
							<th>
								<div class="layui-table-cell" align="center"><span>文章标题</span></div>
							</th>
							<th>
								<div class="layui-table-cell" align="center"><span>发布者</span></div>
							</th>
							<th>
								<div class="layui-table-cell" align="center"><span>删除时间</span></div>
							</th>
							<th>
								<div class="layui-table-cell" align="center"><span>操作</span></div>
							</th>
						</tr>
					</thead>
					
					<tbody>
					    {foreach $list as $val}
						<tr align="center">
						    <td class="layui-table-col-special">
								<input type="checkbox" name="fav" value="{$val.id},{$val.mid},{$val.tabname}">
							</td>
							<td>{$val.id}</td>
							<td>{$val.title}</td>
							<td>{$val.author}</td>
							<td>{$val.delete_time|date='Y:m:d'}</td>
							<td align="center"  class="layui-table-col-special">
								<div class="layui-table-cell">
								    <a class="layui-btn layui-bg-green layui-btn-xs" onclick="matterst('{$val.id}','{$val.mid}','{$val.tabname}','materhy','是否还原')" href="javascript:;"><i class="layui-icon layui-icon-refresh"></i>还原内容</a>
								    <a class="layui-btn layui-btn-xs layui-btn-warm" onclick="matterdel('{$val.id}','{$val.tabname}')" href="javascript:;"><i class="layui-icon layui-icon-delete" ></i>彻底删除</a>
								</div>
							</td>
						</tr>
						{/foreach}
					</tbody>
				</table>
            </div>
            <div class="layui-box layui-laypage layui-laypage-molv"></div>
		{else/}
		<div class="layui-fluid">
        <div class="layadmin-tips">
        <i class="layui-icon" face>&#xe69c;</i>
        <div class="layui-text" style="font-size: 20px;">
                什么都没有!
        </div>
    
  </div>
</div>
		{/if}
		</div>
    </div>
	</div>


	<!-- 低部区域 -->
	{include file='public/footer'}
<script>
layui.config({
    base: '__ADMINST__layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['form','element'], function(){
  var $ = layui.jquery
  ,form = layui.form
  ,element = layui.element;
  
  });
  
  function rescheck(){
    var aid=$("tbody input:checkbox");
	var ids=[];
	ids = allcheck(ids,aid,false);
	if(ids == ""){
	    layer.msg('当前未选择任何信息!',{icon:2,time:2000});
	}else{
	ids = ids.substring(0, ids.length - 1);    
	var Data = {all:ids};
	matajax(Data,'materhy','是否批量还原');
	}
  }
  //单还原
  function matterst(id,lmid,tab,url,msg){
  	var Data = {id:id,mid:lmid,tabname:tab};
  	matajax(Data,url,msg);
  }
  //批量删除
  function delcheck(){
    var aid=$("tbody input:checkbox");
	var ids=[];
	ids = allcheck(ids,aid,false);
	if(ids == ""){
	    layer.msg('当前未选择任何信息!',{icon:2,time:2000});
	}else{
	ids = ids.substring(0, ids.length - 1);    
	var Data = {all:ids};
	matajax(Data,'matdelall','是否批量删除');
	}  
  }
  function matterdel(id,tab){
    var Data = {id:id,tabname:tab};
  	matajax(Data,'matdelall','是否彻底删除此文章');  
  }
  function matajax(Data,url,msg){
    layer.msg(msg+'?', {
  	time: 3000, //5s后自动关闭
  	shade: 0.3,
  	btn: ['确定', '取消'],
  	yes: function() {
  	$.ajax({
      type:'POST',
      data:Data,
	   url:"{:url('admin/Matter/"+url+"')}",
	   dataType :"json",
	   beforeSend: function() {
			    index = layer.load();
            },
        success:function(data){      
			if(data.code == 1){
			layer.msg(data.msg,{time:2000},function(){
            location.reload();
			});
			}else{
			layer.msg(data.msg,{time:2000}); 
			}
		},
		complete:function(){
			layer.close(index);
        }
    });
  	}
  });  
  }
</script>
</body>
</html>	